﻿using BuddHa.Wechat.Mini.Dispatch;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BuddHa.Wechat.Mini
{
    public static class WechatDependencyInjection
    {
        public static IServiceCollection AddWechatCore(this IServiceCollection serviceCollection)
        {
            var jsonSerializerOptions = ConstWechat.CreateDefaultJsonSerializerOptions();
            serviceCollection.AddSingleton<IWechatDispatch, WechatDispatch>();
            serviceCollection.AddAthenaHttp((config) =>
            {
                config.DefaultJsonSerializerOptionsBuilder = () => jsonSerializerOptions;
            });
            return serviceCollection;
        }
    }
}
